<?php

/**
 * Created by PhpStorm.
 * User: ChengChaogui
 * Date: 2016/11/27
 * Time: 20:49
 */
namespace App\Framework\Model;

class Message
{
    public $success;
    public $info;
    public $fail;
    public $value;

    public function __construct($is_suc, $info, $value='')
    {
        $this->success = $is_suc ? $is_suc : false;
        $this->fail = !$this->success;
        $this->info = $info;
        $this->value = $value;
    }

    public function getSuccess()
    {
        return $this->success;
    }

    public function getFail()
    {
        return $this->fail;
    }

    public function getInfo()
    {
        return $this->info;
    }

    public function getValue()
    {
        return $this->value;
    }

    public static function setTrue($info, $value='')
    {
        return new Message(true, $info, $value);
    }

    public static function setFalse($info, $value='')
    {
        return new Message(false, $info, $value);
    }
}